package com.kk.xhr.model.assembler;

import com.kk.xhr.common.pojo.BinaryEnum;
import com.kk.xhr.common.pojo.SignStatusEnum;
import com.kk.xhr.model.dto.NotificationDTO;
import com.kk.xhr.model.dto.SignDTO;
import com.kk.xhr.model.entity.Notification;
import com.kk.xhr.model.entity.Sign;
import org.aspectj.weaver.ast.Not;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * 通知数据转换工具类
 *
 * @author kkmystery
 * @version 1.0 2021/2/28 11:31
 * @since 1.0.0
 */
@Mapper(componentModel = "spring")
public interface NotificationStructKit {

    NotificationStructKit INSTANCE = Mappers.getMapper(NotificationStructKit.class);

    /**
     * dto -> entity
     *
     * @param dto dto
     * @return entity
     */
    Notification toEntity(NotificationDTO dto);

    /**
     * entity -> dto
     *
     * @param entity entity
     * @return dto
     */
    NotificationDTO toDto(Notification entity);

    default BinaryEnum statusConvertor(Byte status) {
        if (null == status) {
            return null;
        }
        return BinaryEnum.from(status);
    }

    default Byte statusConvertor(BinaryEnum status) {
        if (null == status) {
            return null;
        }
        return status.getValue();
    }
}
